#ifndef GFX_H
#define GFX_H

#include <vector>
using namespace std;
#include "Matrices.h"
class GLWidget;

#include <QtOpenGL\QGLWidget>
class CData;

//#ifndef GL_MULTISAMPLE
//#define GL_MULTISAMPLE  0x809D
//#endif

class CGfx 
{
public:
    CGfx(CData* pData_=NULL);
    ~CGfx();
    
    enum ExptState {BeforeRun, OnBreak, NormalView, BirdView, AfterRun, ExpEnd};
    
    //data accesser
    const enum ExptState& exptState() const {return _eCurrExptState;}
          enum ExptState& setExptState() {return _eCurrExptState;}
    const bool& showScene() const {return _bShowScene;}
          bool& setShowScene()    {return _bShowScene;}
    
public:
    virtual void initGL();                                  //rendering environment initialization
    virtual void resizeGL(int nWidth_, int nHeight_);       //resize the opengl window
    virtual void renderBreak();                             //render the break between each pair of trials
    virtual void updateStatus();                            //over rendering flow control
    virtual void renderNormalView();                        //main GL painting functions go here
    virtual void renderBirdView();                          //render bird view
    virtual void offlineRender();                           //light weight render for pre-run experiment
    virtual void catchTriggerRiseEdge();                    //catch the joystick trigger pressing down

    virtual void renderObj()=0;                             //render objects including targets, stimuli rendering
    virtual void updateBirdObserver(int nCurrentFrame_)=0;  //set bird view camera 
    virtual void updateObserver(int nCurrentFrame_)=0;      //set normal view camera
    virtual void LoadParametersFromScript()=0;              //load variables from script files
    virtual void initDisplayList()=0;                       //set up the displaylist 

protected:

    CData* _pData;
    enum ExptState	_eCurrExptState;

    bool _bShowScene;
    bool _bTriggerLastFrame;
    int  _nLastFrameTimeIdx;
};

#endif
